'''
Created on Jan 28, 2014

@author: dmen
'''
from com.ad.sword.utils.Reflect import getClass
from com.ad.sword.task.Executor import TaskExecutor
from com.ad.sword import Constants
class Task:
    def __init__(self,s):
        try:
            type=s['type']
            eClass=getClass("com.ad.sword.task.Executor",Constants.TASK_EXECUTOR_TYPES[type])
        except Exception:
            eClass=TaskExecutor
        self.executor=eClass(s)
    def start(self):
        self.executor.execute()